blob: 8da1704dc3014a78683822f7618f97527790b8ee [file] [log] [blame]
Junio C Hamanob9d9d902018-05-23 07:07:421<?xml version="1.0" encoding="UTF-8"?>
Junio C Hamano2fbcd212008-05-14 22:26:072<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
5<head>
Junio C Hamano9d971152012-12-19 00:43:116<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
Junio C Hamanoa85030a2022-07-27 16:48:217<meta name="generator" content="AsciiDoc 10.2.0" />
Junio C Hamano81435632011-01-12 09:08:488<title>githooks(5)</title>
Junio C Hamano2fbcd212008-05-14 22:26:079<style type="text/css">
Junio C Hamano9d971152012-12-19 00:43:1110/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
11
12/* Default font. */
13body {
14 font-family: Georgia,serif;
15}
16
17/* Title font. */
18h1, h2, h3, h4, h5, h6,
19div.title, caption.title,
20thead, p.table.header,
21#toctitle,
22#author, #revnumber, #revdate, #revremark,
23#footer {
24 font-family: Arial,Helvetica,sans-serif;
Junio C Hamano2fbcd212008-05-14 22:26:0725}
26
27body {
28 margin: 1em 5% 1em 5%;
29}
30
Junio C Hamanoba4b9282008-07-06 05:20:3131a {
32 color: blue;
33 text-decoration: underline;
34}
35a:visited {
36 color: fuchsia;
37}
Junio C Hamano2fbcd212008-05-14 22:26:0738
39em {
40 font-style: italic;
Junio C Hamano81435632011-01-12 09:08:4841 color: navy;
Junio C Hamano2fbcd212008-05-14 22:26:0742}
43
44strong {
45 font-weight: bold;
Junio C Hamano81435632011-01-12 09:08:4846 color: #083194;
Junio C Hamano2fbcd212008-05-14 22:26:0747}
48
Junio C Hamano2fbcd212008-05-14 22:26:0749h1, h2, h3, h4, h5, h6 {
50 color: #527bbd;
Junio C Hamano2fbcd212008-05-14 22:26:0751 margin-top: 1.2em;
52 margin-bottom: 0.5em;
53 line-height: 1.3;
54}
55
Junio C Hamanoba4b9282008-07-06 05:20:3156h1, h2, h3 {
Junio C Hamano2fbcd212008-05-14 22:26:0757 border-bottom: 2px solid silver;
58}
59h2 {
Junio C Hamano2fbcd212008-05-14 22:26:0760 padding-top: 0.5em;
61}
Junio C Hamanoba4b9282008-07-06 05:20:3162h3 {
63 float: left;
64}
65h3 + * {
66 clear: left;
67}
Junio C Hamano9d971152012-12-19 00:43:1168h5 {
69 font-size: 1.0em;
70}
Junio C Hamano2fbcd212008-05-14 22:26:0771
72div.sectionbody {
Junio C Hamano2fbcd212008-05-14 22:26:0773 margin-left: 0;
74}
75
76hr {
77 border: 1px solid silver;
78}
79
80p {
81 margin-top: 0.5em;
82 margin-bottom: 0.5em;
83}
84
Junio C Hamano81435632011-01-12 09:08:4885ul, ol, li > p {
86 margin-top: 0;
87}
Junio C Hamano9d971152012-12-19 00:43:1188ul > li { color: #aaa; }
89ul > li > * { color: black; }
Junio C Hamano81435632011-01-12 09:08:4890
Junio C Hamanoc14e6ad2014-10-31 20:25:5391.monospaced, code, pre {
92 font-family: "Courier New", Courier, monospace;
93 font-size: inherit;
94 color: navy;
Junio C Hamano2fbcd212008-05-14 22:26:0795 padding: 0;
96 margin: 0;
97}
Junio C Hamanoc14e6ad2014-10-31 20:25:5398pre {
99 white-space: pre-wrap;
100}
Junio C Hamano2fbcd212008-05-14 22:26:07101
Junio C Hamano9d971152012-12-19 00:43:11102#author {
Junio C Hamano2fbcd212008-05-14 22:26:07103 color: #527bbd;
Junio C Hamano2fbcd212008-05-14 22:26:07104 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:31105 font-size: 1.1em;
Junio C Hamano2fbcd212008-05-14 22:26:07106}
Junio C Hamano9d971152012-12-19 00:43:11107#email {
Junio C Hamano2fbcd212008-05-14 22:26:07108}
Junio C Hamano9d971152012-12-19 00:43:11109#revnumber, #revdate, #revremark {
Junio C Hamano2fbcd212008-05-14 22:26:07110}
111
Junio C Hamano9d971152012-12-19 00:43:11112#footer {
Junio C Hamano2fbcd212008-05-14 22:26:07113 font-size: small;
114 border-top: 2px solid silver;
115 padding-top: 0.5em;
116 margin-top: 4.0em;
117}
Junio C Hamano9d971152012-12-19 00:43:11118#footer-text {
Junio C Hamano2fbcd212008-05-14 22:26:07119 float: left;
120 padding-bottom: 0.5em;
121}
Junio C Hamano9d971152012-12-19 00:43:11122#footer-badges {
Junio C Hamano2fbcd212008-05-14 22:26:07123 float: right;
124 padding-bottom: 0.5em;
125}
126
Junio C Hamano9d971152012-12-19 00:43:11127#preamble {
Junio C Hamano81435632011-01-12 09:08:48128 margin-top: 1.5em;
129 margin-bottom: 1.5em;
130}
Junio C Hamano9d971152012-12-19 00:43:11131div.imageblock, div.exampleblock, div.verseblock,
Junio C Hamano2fbcd212008-05-14 22:26:07132div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
133div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22134 margin-top: 1.0em;
Junio C Hamano2fbcd212008-05-14 22:26:07135 margin-bottom: 1.5em;
136}
137div.admonitionblock {
Junio C Hamano7bd050f2011-09-22 06:32:22138 margin-top: 2.0em;
139 margin-bottom: 2.0em;
140 margin-right: 10%;
141 color: #606060;
Junio C Hamano2fbcd212008-05-14 22:26:07142}
143
144div.content { /* Block element content. */
145 padding: 0;
146}
147
148/* Block element titles. */
149div.title, caption.title {
Junio C Hamano81435632011-01-12 09:08:48150 color: #527bbd;
Junio C Hamano2fbcd212008-05-14 22:26:07151 font-weight: bold;
152 text-align: left;
153 margin-top: 1.0em;
154 margin-bottom: 0.5em;
155}
156div.title + * {
157 margin-top: 0;
158}
159
160td div.title:first-child {
161 margin-top: 0.0em;
162}
163div.content div.title:first-child {
164 margin-top: 0.0em;
165}
166div.content + div.title {
167 margin-top: 0.0em;
168}
169
170div.sidebarblock > div.content {
171 background: #ffffee;
Junio C Hamano9d971152012-12-19 00:43:11172 border: 1px solid #dddddd;
173 border-left: 4px solid #f0f0f0;
Junio C Hamano2fbcd212008-05-14 22:26:07174 padding: 0.5em;
175}
176
177div.listingblock > div.content {
Junio C Hamano9d971152012-12-19 00:43:11178 border: 1px solid #dddddd;
179 border-left: 5px solid #f0f0f0;
180 background: #f8f8f8;
Junio C Hamano2fbcd212008-05-14 22:26:07181 padding: 0.5em;
182}
183
Junio C Hamano7bd050f2011-09-22 06:32:22184div.quoteblock, div.verseblock {
185 padding-left: 1.0em;
186 margin-left: 1.0em;
Junio C Hamano81435632011-01-12 09:08:48187 margin-right: 10%;
Junio C Hamano9d971152012-12-19 00:43:11188 border-left: 5px solid #f0f0f0;
189 color: #888;
Junio C Hamano2fbcd212008-05-14 22:26:07190}
Junio C Hamano7bd050f2011-09-22 06:32:22191
Junio C Hamano81435632011-01-12 09:08:48192div.quoteblock > div.attribution {
193 padding-top: 0.5em;
Junio C Hamano2fbcd212008-05-14 22:26:07194 text-align: right;
195}
Junio C Hamano81435632011-01-12 09:08:48196
Junio C Hamano9d971152012-12-19 00:43:11197div.verseblock > pre.content {
198 font-family: inherit;
199 font-size: inherit;
Junio C Hamano81435632011-01-12 09:08:48200}
201div.verseblock > div.attribution {
202 padding-top: 0.75em;
203 text-align: left;
204}
205/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
Junio C Hamanoba4b9282008-07-06 05:20:31206div.verseblock + div.attribution {
207 text-align: left;
208}
Junio C Hamano2fbcd212008-05-14 22:26:07209
210div.admonitionblock .icon {
211 vertical-align: top;
212 font-size: 1.1em;
213 font-weight: bold;
214 text-decoration: underline;
215 color: #527bbd;
216 padding-right: 0.5em;
217}
218div.admonitionblock td.content {
219 padding-left: 0.5em;
Junio C Hamano7bd050f2011-09-22 06:32:22220 border-left: 3px solid #dddddd;
Junio C Hamano2fbcd212008-05-14 22:26:07221}
222
223div.exampleblock > div.content {
Junio C Hamano7bd050f2011-09-22 06:32:22224 border-left: 3px solid #dddddd;
225 padding-left: 0.5em;
Junio C Hamano2fbcd212008-05-14 22:26:07226}
227
Junio C Hamano2fbcd212008-05-14 22:26:07228div.imageblock div.content { padding-left: 0; }
Junio C Hamanoc14e6ad2014-10-31 20:25:53229span.image img { border-style: none; vertical-align: text-bottom; }
Junio C Hamano81435632011-01-12 09:08:48230a.image:visited { color: white; }
Junio C Hamano2fbcd212008-05-14 22:26:07231
232dl {
233 margin-top: 0.8em;
234 margin-bottom: 0.8em;
235}
236dt {
237 margin-top: 0.5em;
238 margin-bottom: 0;
Junio C Hamano81435632011-01-12 09:08:48239 font-style: normal;
240 color: navy;
Junio C Hamano2fbcd212008-05-14 22:26:07241}
242dd > *:first-child {
Junio C Hamano81435632011-01-12 09:08:48243 margin-top: 0.1em;
Junio C Hamano2fbcd212008-05-14 22:26:07244}
245
246ul, ol {
247 list-style-position: outside;
248}
Junio C Hamano81435632011-01-12 09:08:48249ol.arabic {
250 list-style-type: decimal;
251}
252ol.loweralpha {
Junio C Hamano2fbcd212008-05-14 22:26:07253 list-style-type: lower-alpha;
254}
Junio C Hamano81435632011-01-12 09:08:48255ol.upperalpha {
256 list-style-type: upper-alpha;
257}
258ol.lowerroman {
259 list-style-type: lower-roman;
260}
261ol.upperroman {
262 list-style-type: upper-roman;
263}
264
265div.compact ul, div.compact ol,
266div.compact p, div.compact p,
267div.compact div, div.compact div {
268 margin-top: 0.1em;
269 margin-bottom: 0.1em;
270}
Junio C Hamano2fbcd212008-05-14 22:26:07271
Junio C Hamano2fbcd212008-05-14 22:26:07272tfoot {
273 font-weight: bold;
274}
Junio C Hamano81435632011-01-12 09:08:48275td > div.verse {
276 white-space: pre;
277}
Junio C Hamano81435632011-01-12 09:08:48278
279div.hdlist {
Junio C Hamano2fbcd212008-05-14 22:26:07280 margin-top: 0.8em;
281 margin-bottom: 0.8em;
282}
Junio C Hamano81435632011-01-12 09:08:48283div.hdlist tr {
284 padding-bottom: 15px;
Junio C Hamanoba4b9282008-07-06 05:20:31285}
Junio C Hamano81435632011-01-12 09:08:48286dt.hdlist1.strong, td.hdlist1.strong {
287 font-weight: bold;
288}
289td.hdlist1 {
Junio C Hamano2fbcd212008-05-14 22:26:07290 vertical-align: top;
Junio C Hamano81435632011-01-12 09:08:48291 font-style: normal;
Junio C Hamano2fbcd212008-05-14 22:26:07292 padding-right: 0.8em;
Junio C Hamano81435632011-01-12 09:08:48293 color: navy;
Junio C Hamano2fbcd212008-05-14 22:26:07294}
Junio C Hamano81435632011-01-12 09:08:48295td.hdlist2 {
Junio C Hamano2fbcd212008-05-14 22:26:07296 vertical-align: top;
297}
Junio C Hamano81435632011-01-12 09:08:48298div.hdlist.compact tr {
299 margin: 0;
300 padding-bottom: 0;
301}
302
303.comment {
304 background: yellow;
305}
Junio C Hamano2fbcd212008-05-14 22:26:07306
Junio C Hamano7bd050f2011-09-22 06:32:22307.footnote, .footnoteref {
308 font-size: 0.8em;
309}
310
311span.footnote, span.footnoteref {
312 vertical-align: super;
313}
314
315#footnotes {
316 margin: 20px 0 20px 0;
317 padding: 7px 0 0 0;
318}
319
320#footnotes div.footnote {
321 margin: 0 0 5px 0;
322}
323
324#footnotes hr {
325 border: none;
326 border-top: 1px solid silver;
327 height: 1px;
328 text-align: left;
329 margin-left: 0;
330 width: 20%;
331 min-width: 100px;
332}
333
Junio C Hamano9d971152012-12-19 00:43:11334div.colist td {
335 padding-right: 0.5em;
336 padding-bottom: 0.3em;
337 vertical-align: top;
338}
339div.colist td img {
340 margin-top: 0.3em;
Junio C Hamano2fbcd212008-05-14 22:26:07341}
Junio C Hamanoba4b9282008-07-06 05:20:31342
Junio C Hamano9d971152012-12-19 00:43:11343@media print {
344 #footer-badges { display: none; }
345}
346
347#toc {
Junio C Hamano7bd050f2011-09-22 06:32:22348 margin-bottom: 2.5em;
349}
350
Junio C Hamano9d971152012-12-19 00:43:11351#toctitle {
Junio C Hamanoba4b9282008-07-06 05:20:31352 color: #527bbd;
Junio C Hamanoba4b9282008-07-06 05:20:31353 font-size: 1.1em;
354 font-weight: bold;
355 margin-top: 1.0em;
356 margin-bottom: 0.1em;
357}
358
Junio C Hamanoc14e6ad2014-10-31 20:25:53359div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
Junio C Hamanoba4b9282008-07-06 05:20:31360 margin-top: 0;
361 margin-bottom: 0;
362}
363div.toclevel2 {
364 margin-left: 2em;
365 font-size: 0.9em;
366}
367div.toclevel3 {
368 margin-left: 4em;
369 font-size: 0.9em;
370}
371div.toclevel4 {
372 margin-left: 6em;
373 font-size: 0.9em;
374}
Junio C Hamano9d971152012-12-19 00:43:11375
376span.aqua { color: aqua; }
377span.black { color: black; }
378span.blue { color: blue; }
379span.fuchsia { color: fuchsia; }
380span.gray { color: gray; }
381span.green { color: green; }
382span.lime { color: lime; }
383span.maroon { color: maroon; }
384span.navy { color: navy; }
385span.olive { color: olive; }
386span.purple { color: purple; }
387span.red { color: red; }
388span.silver { color: silver; }
389span.teal { color: teal; }
390span.white { color: white; }
391span.yellow { color: yellow; }
392
393span.aqua-background { background: aqua; }
394span.black-background { background: black; }
395span.blue-background { background: blue; }
396span.fuchsia-background { background: fuchsia; }
397span.gray-background { background: gray; }
398span.green-background { background: green; }
399span.lime-background { background: lime; }
400span.maroon-background { background: maroon; }
401span.navy-background { background: navy; }
402span.olive-background { background: olive; }
403span.purple-background { background: purple; }
404span.red-background { background: red; }
405span.silver-background { background: silver; }
406span.teal-background { background: teal; }
407span.white-background { background: white; }
408span.yellow-background { background: yellow; }
409
410span.big { font-size: 2em; }
411span.small { font-size: 0.6em; }
412
413span.underline { text-decoration: underline; }
414span.overline { text-decoration: overline; }
415span.line-through { text-decoration: line-through; }
416
Junio C Hamanoc14e6ad2014-10-31 20:25:53417div.unbreakable { page-break-inside: avoid; }
418
Junio C Hamano9d971152012-12-19 00:43:11419
420/*
421 * xhtml11 specific
422 *
423 * */
424
425div.tableblock {
426 margin-top: 1.0em;
427 margin-bottom: 1.5em;
428}
429div.tableblock > table {
430 border: 3px solid #527bbd;
431}
432thead, p.table.header {
433 font-weight: bold;
434 color: #527bbd;
435}
436p.table {
437 margin-top: 0;
438}
Junio C Hamano725b0da2020-01-22 22:02:40439/* Because the table frame attribute is overridden by CSS in most browsers. */
Junio C Hamano9d971152012-12-19 00:43:11440div.tableblock > table[frame="void"] {
441 border-style: none;
442}
443div.tableblock > table[frame="hsides"] {
444 border-left-style: none;
445 border-right-style: none;
446}
447div.tableblock > table[frame="vsides"] {
448 border-top-style: none;
449 border-bottom-style: none;
450}
451
452
453/*
454 * html5 specific
455 *
456 * */
457
458table.tableblock {
459 margin-top: 1.0em;
460 margin-bottom: 1.5em;
461}
462thead, p.tableblock.header {
463 font-weight: bold;
464 color: #527bbd;
465}
466p.tableblock {
467 margin-top: 0;
468}
469table.tableblock {
470 border-width: 3px;
471 border-spacing: 0px;
472 border-style: solid;
473 border-color: #527bbd;
474 border-collapse: collapse;
475}
476th.tableblock, td.tableblock {
477 border-width: 1px;
478 padding: 4px;
479 border-style: solid;
480 border-color: #527bbd;
481}
482
483table.tableblock.frame-topbot {
484 border-left-style: hidden;
485 border-right-style: hidden;
486}
487table.tableblock.frame-sides {
488 border-top-style: hidden;
489 border-bottom-style: hidden;
490}
491table.tableblock.frame-none {
492 border-style: hidden;
493}
494
495th.tableblock.halign-left, td.tableblock.halign-left {
496 text-align: left;
497}
498th.tableblock.halign-center, td.tableblock.halign-center {
499 text-align: center;
500}
501th.tableblock.halign-right, td.tableblock.halign-right {
502 text-align: right;
503}
504
505th.tableblock.valign-top, td.tableblock.valign-top {
506 vertical-align: top;
507}
508th.tableblock.valign-middle, td.tableblock.valign-middle {
509 vertical-align: middle;
510}
511th.tableblock.valign-bottom, td.tableblock.valign-bottom {
512 vertical-align: bottom;
513}
514
515
516/*
517 * manpage specific
518 *
519 * */
520
521body.manpage h1 {
Junio C Hamano81435632011-01-12 09:08:48522 padding-top: 0.5em;
523 padding-bottom: 0.5em;
524 border-top: 2px solid silver;
525 border-bottom: 2px solid silver;
526}
Junio C Hamano9d971152012-12-19 00:43:11527body.manpage h2 {
Junio C Hamano81435632011-01-12 09:08:48528 border-style: none;
529}
Junio C Hamano9d971152012-12-19 00:43:11530body.manpage div.sectionbody {
531 margin-left: 3em;
Junio C Hamano81435632011-01-12 09:08:48532}
533
534@media print {
Junio C Hamano9d971152012-12-19 00:43:11535 body.manpage div#toc { display: none; }
Junio C Hamano81435632011-01-12 09:08:48536}
Junio C Hamanoc14e6ad2014-10-31 20:25:53537
538
Junio C Hamano2fbcd212008-05-14 22:26:07539</style>
Junio C Hamano7bd050f2011-09-22 06:32:22540<script type="text/javascript">
541/*<![CDATA[*/
Junio C Hamano2b153182021-12-15 21:00:31542var asciidoc = { // Namespace.
543
544/////////////////////////////////////////////////////////////////////
545// Table Of Contents generator
546/////////////////////////////////////////////////////////////////////
547
548/* Author: Mihai Bazon, September 2002
549 * http://students.infoiasi.ro/~mishoo
550 *
551 * Table Of Content generator
552 * Version: 0.4
553 *
554 * Feel free to use this script under the terms of the GNU General Public
555 * License, as long as you do not remove or alter this notice.
556 */
557
558 /* modified by Troy D. Hanson, September 2006. License: GPL */
559 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
560
561// toclevels = 1..4.
562toc: function (toclevels) {
563
564 function getText(el) {
565 var text = "";
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
567 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
568 text += i.data;
569 else if (i.firstChild != null)
570 text += getText(i);
571 }
572 return text;
573 }
574
575 function TocEntry(el, text, toclevel) {
576 this.element = el;
577 this.text = text;
578 this.toclevel = toclevel;
579 }
580
581 function tocEntries(el, toclevels) {
582 var result = new Array;
583 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
584 // Function that scans the DOM tree for header elements (the DOM2
585 // nodeIterator API would be a better technique but not supported by all
586 // browsers).
587 var iterate = function (el) {
588 for (var i = el.firstChild; i != null; i = i.nextSibling) {
589 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
590 var mo = re.exec(i.tagName);
591 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
592 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
593 }
594 iterate(i);
595 }
596 }
597 }
598 iterate(el);
599 return result;
600 }
601
602 var toc = document.getElementById("toc");
603 if (!toc) {
604 return;
605 }
606
607 // Delete existing TOC entries in case we're reloading the TOC.
608 var tocEntriesToRemove = [];
609 var i;
610 for (i = 0; i < toc.childNodes.length; i++) {
611 var entry = toc.childNodes[i];
612 if (entry.nodeName.toLowerCase() == 'div'
613 && entry.getAttribute("class")
614 && entry.getAttribute("class").match(/^toclevel/))
615 tocEntriesToRemove.push(entry);
616 }
617 for (i = 0; i < tocEntriesToRemove.length; i++) {
618 toc.removeChild(tocEntriesToRemove[i]);
619 }
620
621 // Rebuild TOC entries.
622 var entries = tocEntries(document.getElementById("content"), toclevels);
623 for (var i = 0; i < entries.length; ++i) {
624 var entry = entries[i];
625 if (entry.element.id == "")
626 entry.element.id = "_toc_" + i;
627 var a = document.createElement("a");
628 a.href = "#" + entry.element.id;
629 a.appendChild(document.createTextNode(entry.text));
630 var div = document.createElement("div");
631 div.appendChild(a);
632 div.className = "toclevel" + entry.toclevel;
633 toc.appendChild(div);
634 }
635 if (entries.length == 0)
636 toc.parentNode.removeChild(toc);
637},
638
639
640/////////////////////////////////////////////////////////////////////
641// Footnotes generator
642/////////////////////////////////////////////////////////////////////
643
644/* Based on footnote generation code from:
645 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
646 */
647
648footnotes: function () {
649 // Delete existing footnote entries in case we're reloading the footnodes.
650 var i;
651 var noteholder = document.getElementById("footnotes");
652 if (!noteholder) {
653 return;
654 }
655 var entriesToRemove = [];
656 for (i = 0; i < noteholder.childNodes.length; i++) {
657 var entry = noteholder.childNodes[i];
658 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
659 entriesToRemove.push(entry);
660 }
661 for (i = 0; i < entriesToRemove.length; i++) {
662 noteholder.removeChild(entriesToRemove[i]);
663 }
664
665 // Rebuild footnote entries.
666 var cont = document.getElementById("content");
667 var spans = cont.getElementsByTagName("span");
668 var refs = {};
669 var n = 0;
670 for (i=0; i<spans.length; i++) {
671 if (spans[i].className == "footnote") {
672 n++;
673 var note = spans[i].getAttribute("data-note");
674 if (!note) {
675 // Use [\s\S] in place of . so multi-line matches work.
676 // Because JavaScript has no s (dotall) regex flag.
677 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
678 spans[i].innerHTML =
679 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
680 "' title='View footnote' class='footnote'>" + n + "</a>]";
681 spans[i].setAttribute("data-note", note);
682 }
683 noteholder.innerHTML +=
684 "<div class='footnote' id='_footnote_" + n + "'>" +
685 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
686 n + "</a>. " + note + "</div>";
687 var id =spans[i].getAttribute("id");
688 if (id != null) refs["#"+id] = n;
689 }
690 }
691 if (n == 0)
692 noteholder.parentNode.removeChild(noteholder);
693 else {
694 // Process footnoterefs.
695 for (i=0; i<spans.length; i++) {
696 if (spans[i].className == "footnoteref") {
697 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
698 href = href.match(/#.*/)[0]; // Because IE return full URL.
699 n = refs[href];
700 spans[i].innerHTML =
701 "[<a href='#_footnote_" + n +
702 "' title='View footnote' class='footnote'>" + n + "</a>]";
703 }
704 }
705 }
706},
707
708install: function(toclevels) {
709 var timerId;
710
711 function reinstall() {
712 asciidoc.footnotes();
713 if (toclevels) {
714 asciidoc.toc(toclevels);
715 }
716 }
717
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
720 reinstall();
721 }
722
723 timerId = setInterval(reinstall, 500);
724 if (document.addEventListener)
725 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
726 else
727 window.onload = reinstallAndRemoveTimer;
728}
729
730}
Junio C Hamano9d971152012-12-19 00:43:11731asciidoc.install();
Junio C Hamano7bd050f2011-09-22 06:32:22732/*]]>*/
733</script>
Junio C Hamano2fbcd212008-05-14 22:26:07734</head>
Junio C Hamano9d971152012-12-19 00:43:11735<body class="manpage">
Junio C Hamano2fbcd212008-05-14 22:26:07736<div id="header">
737<h1>
738githooks(5) Manual Page
739</h1>
740<h2>NAME</h2>
741<div class="sectionbody">
742<p>githooks -
Junio C Hamano076ffcc2013-02-06 05:13:21743 Hooks used by Git
Junio C Hamano2fbcd212008-05-14 22:26:07744</p>
745</div>
746</div>
Junio C Hamano7bd050f2011-09-22 06:32:22747<div id="content">
Junio C Hamano9d971152012-12-19 00:43:11748<div class="sect1">
Junio C Hamano81435632011-01-12 09:08:48749<h2 id="_synopsis">SYNOPSIS</h2>
Junio C Hamano2fbcd212008-05-14 22:26:07750<div class="sectionbody">
Junio C Hamano198b1f12016-05-17 22:27:24751<div class="paragraph"><p>$GIT_DIR/hooks/* (or `git config core.hooksPath`/*)</p></div>
Junio C Hamano2fbcd212008-05-14 22:26:07752</div>
Junio C Hamano9d971152012-12-19 00:43:11753</div>
754<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:31755<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano2fbcd212008-05-14 22:26:07756<div class="sectionbody">
Junio C Hamano198b1f12016-05-17 22:27:24757<div class="paragraph"><p>Hooks are programs you can place in a hooks directory to trigger
758actions at certain points in git&#8217;s execution. Hooks that don&#8217;t have
759the executable bit set are ignored.</p></div>
760<div class="paragraph"><p>By default the hooks directory is <code>$GIT_DIR/hooks</code>, but that can be
761changed via the <code>core.hooksPath</code> configuration variable (see
762<a href="git-config.html">git-config(1)</a>).</p></div>
763<div class="paragraph"><p>Before Git invokes a hook, it changes its working directory to either
Junio C Hamano4c60d9a2017-05-04 14:36:22764$GIT_DIR in a bare repository or the root of the working tree in a non-bare
765repository. An exception are hooks triggered during a push (<em>pre-receive</em>,
766<em>update</em>, <em>post-receive</em>, <em>post-update</em>, <em>push-to-checkout</em>) which are always
767executed in $GIT_DIR.</p></div>
Junio C Hamanoa75aada2023-01-22 01:54:30768<div class="paragraph"><p>Environment variables, such as <code>GIT_DIR</code>, <code>GIT_WORK_TREE</code>, etc., are exported
769so that Git commands run by the hook can correctly locate the repository. If
770your hook needs to invoke Git commands in a foreign repository or in a
771different working tree of the same repository, then it should clear these
772environment variables so they do not interfere with Git operations at the
773foreign location. For example:</p></div>
774<div class="listingblock">
775<div class="content">
776<pre><code>local_desc=$(git describe)
777foreign_desc=$(unset $(git rev-parse --local-env-vars); git -C ../foreign-repo describe)</code></pre>
778</div></div>
Junio C Hamano198b1f12016-05-17 22:27:24779<div class="paragraph"><p>Hooks can get their arguments via the environment, command-line
780arguments, and stdin. See the documentation for each hook below for
781details.</p></div>
Junio C Hamanob9d9d902018-05-23 07:07:42782<div class="paragraph"><p><code>git init</code> may copy hooks to the new repository, depending on its
Junio C Hamano198b1f12016-05-17 22:27:24783configuration. See the "TEMPLATE DIRECTORY" section in
784<a href="git-init.html">git-init(1)</a> for details. When the rest of this document refers
785to "default hooks" it&#8217;s talking about the default template shipped
786with Git.</p></div>
787<div class="paragraph"><p>The currently supported hooks are described below.</p></div>
Junio C Hamano2fbcd212008-05-14 22:26:07788</div>
Junio C Hamano9d971152012-12-19 00:43:11789</div>
790<div class="sect1">
Junio C Hamanoc28068f2009-09-08 00:55:23791<h2 id="_hooks">HOOKS</h2>
Junio C Hamano2fbcd212008-05-14 22:26:07792<div class="sectionbody">
Junio C Hamano9d971152012-12-19 00:43:11793<div class="sect2">
794<h3 id="_applypatch_msg">applypatch-msg</h3>
Junio C Hamanob9d9d902018-05-23 07:07:42795<div class="paragraph"><p>This hook is invoked by <a href="git-am.html">git-am(1)</a>. It takes a single
Junio C Hamano2fbcd212008-05-14 22:26:07796parameter, the name of the file that holds the proposed commit
Junio C Hamanob9d9d902018-05-23 07:07:42797log message. Exiting with a non-zero status causes <code>git am</code> to abort
Junio C Hamano198b1f12016-05-17 22:27:24798before applying the patch.</p></div>
Junio C Hamano81435632011-01-12 09:08:48799<div class="paragraph"><p>The hook is allowed to edit the message file in place, and can
Junio C Hamano2fbcd212008-05-14 22:26:07800be used to normalize the message into some project standard
Junio C Hamano198b1f12016-05-17 22:27:24801format. It can also be used to refuse the commit after inspecting
802the message file.</p></div>
Junio C Hamano81435632011-01-12 09:08:48803<div class="paragraph"><p>The default <em>applypatch-msg</em> hook, when enabled, runs the
Junio C Hamanoba4b9282008-07-06 05:20:31804<em>commit-msg</em> hook, if the latter is enabled.</p></div>
Junio C Hamano9d971152012-12-19 00:43:11805</div>
806<div class="sect2">
807<h3 id="_pre_applypatch">pre-applypatch</h3>
Junio C Hamanob9d9d902018-05-23 07:07:42808<div class="paragraph"><p>This hook is invoked by <a href="git-am.html">git-am(1)</a>. It takes no parameter, and is
Junio C Hamanoba4b9282008-07-06 05:20:31809invoked after the patch is applied, but before a commit is made.</p></div>
Junio C Hamano81435632011-01-12 09:08:48810<div class="paragraph"><p>If it exits with non-zero status, then the working tree will not be
Junio C Hamanoba4b9282008-07-06 05:20:31811committed after applying the patch.</p></div>
Junio C Hamano81435632011-01-12 09:08:48812<div class="paragraph"><p>It can be used to inspect the current working tree and refuse to
Junio C Hamano33be8212023-10-23 21:45:54813make a commit if it does not pass certain tests.</p></div>
Junio C Hamano81435632011-01-12 09:08:48814<div class="paragraph"><p>The default <em>pre-applypatch</em> hook, when enabled, runs the
Junio C Hamanoba4b9282008-07-06 05:20:31815<em>pre-commit</em> hook, if the latter is enabled.</p></div>
Junio C Hamano9d971152012-12-19 00:43:11816</div>
817<div class="sect2">
818<h3 id="_post_applypatch">post-applypatch</h3>
Junio C Hamanob9d9d902018-05-23 07:07:42819<div class="paragraph"><p>This hook is invoked by <a href="git-am.html">git-am(1)</a>. It takes no parameter,
Junio C Hamanoba4b9282008-07-06 05:20:31820and is invoked after the patch is applied and a commit is made.</p></div>
Junio C Hamano81435632011-01-12 09:08:48821<div class="paragraph"><p>This hook is meant primarily for notification, and cannot affect
Junio C Hamanob9d9d902018-05-23 07:07:42822the outcome of <code>git am</code>.</p></div>
Junio C Hamano9d971152012-12-19 00:43:11823</div>
824<div class="sect2">
825<h3 id="_pre_commit">pre-commit</h3>
Junio C Hamanob9d9d902018-05-23 07:07:42826<div class="paragraph"><p>This hook is invoked by <a href="git-commit.html">git-commit(1)</a>, and can be bypassed
Junio C Hamano198b1f12016-05-17 22:27:24827with the <code>--no-verify</code> option. It takes no parameters, and is
Junio C Hamano2fbcd212008-05-14 22:26:07828invoked before obtaining the proposed commit log message and
Junio C Hamano198b1f12016-05-17 22:27:24829making a commit. Exiting with a non-zero status from this script
Junio C Hamanob9d9d902018-05-23 07:07:42830causes the <code>git commit</code> command to abort before creating a commit.</p></div>
Junio C Hamano81435632011-01-12 09:08:48831<div class="paragraph"><p>The default <em>pre-commit</em> hook, when enabled, catches introduction
Junio C Hamano2fbcd212008-05-14 22:26:07832of lines with trailing whitespaces and aborts the commit when
Junio C Hamanoba4b9282008-07-06 05:20:31833such a line is found.</p></div>
Junio C Hamanob9d9d902018-05-23 07:07:42834<div class="paragraph"><p>All the <code>git commit</code> hooks are invoked with the environment
Junio C Hamanoc14e6ad2014-10-31 20:25:53835variable <code>GIT_EDITOR=:</code> if the command will not bring up an editor
Junio C Hamanoba4b9282008-07-06 05:20:31836to modify the commit message.</p></div>
Junio C Hamano11f15372019-03-07 03:17:00837<div class="paragraph"><p>The default <em>pre-commit</em> hook, when enabled&#8212;and with the
838<code>hooks.allownonascii</code> config option unset or set to false&#8212;prevents
839the use of non-ASCII filenames.</p></div>
Junio C Hamano9d971152012-12-19 00:43:11840</div>
841<div class="sect2">
Junio C Hamanocb705392019-09-18 19:30:01842<h3 id="_pre_merge_commit">pre-merge-commit</h3>
843<div class="paragraph"><p>This hook is invoked by <a href="git-merge.html">git-merge(1)</a>, and can be bypassed
844with the <code>--no-verify</code> option. It takes no parameters, and is
845invoked after the merge has been carried out successfully and before
846obtaining the proposed commit log message to
847make a commit. Exiting with a non-zero status from this script
848causes the <code>git merge</code> command to abort before creating a commit.</p></div>
849<div class="paragraph"><p>The default <em>pre-merge-commit</em> hook, when enabled, runs the
850<em>pre-commit</em> hook, if the latter is enabled.</p></div>
851<div class="paragraph"><p>This hook is invoked with the environment variable
852<code>GIT_EDITOR=:</code> if the command will not bring up an editor
853to modify the commit message.</p></div>
854<div class="paragraph"><p>If the merge cannot be carried out automatically, the conflicts
855need to be resolved and the result committed separately (see
856<a href="git-merge.html">git-merge(1)</a>). At that point, this hook will not be executed,
857but the <em>pre-commit</em> hook will, if it is enabled.</p></div>
858</div>
859<div class="sect2">
Junio C Hamano9d971152012-12-19 00:43:11860<h3 id="_prepare_commit_msg">prepare-commit-msg</h3>
Junio C Hamanob9d9d902018-05-23 07:07:42861<div class="paragraph"><p>This hook is invoked by <a href="git-commit.html">git-commit(1)</a> right after preparing the
Junio C Hamanoba4b9282008-07-06 05:20:31862default log message, and before the editor is started.</p></div>
Junio C Hamano81435632011-01-12 09:08:48863<div class="paragraph"><p>It takes one to three parameters. The first is the name of the file
Junio C Hamanobd53dbf2009-01-18 18:26:37864that contains the commit log message. The second is the source of the commit
Junio C Hamanoc14e6ad2014-10-31 20:25:53865message, and can be: <code>message</code> (if a <code>-m</code> or <code>-F</code> option was
866given); <code>template</code> (if a <code>-t</code> option was given or the
867configuration option <code>commit.template</code> is set); <code>merge</code> (if the
868commit is a merge or a <code>.git/MERGE_MSG</code> file exists); <code>squash</code>
869(if a <code>.git/SQUASH_MSG</code> file exists); or <code>commit</code>, followed by
Junio C Hamano458281a2021-03-22 21:20:26870a commit object name (if a <code>-c</code>, <code>-C</code> or <code>--amend</code> option was given).</p></div>
Junio C Hamanob9d9d902018-05-23 07:07:42871<div class="paragraph"><p>If the exit status is non-zero, <code>git commit</code> will abort.</p></div>
Junio C Hamano81435632011-01-12 09:08:48872<div class="paragraph"><p>The purpose of the hook is to edit the message file in place, and
Junio C Hamanoc14e6ad2014-10-31 20:25:53873it is not suppressed by the <code>--no-verify</code> option. A non-zero exit
Junio C Hamano2fbcd212008-05-14 22:26:07874means a failure of the hook and aborts the commit. It should not
Junio C Hamano33be8212023-10-23 21:45:54875be used as a replacement for the pre-commit hook.</p></div>
Junio C Hamano4b2a6c12017-08-22 18:32:37876<div class="paragraph"><p>The sample <code>prepare-commit-msg</code> hook that comes with Git removes the
877help message found in the commented portion of the commit template.</p></div>
Junio C Hamano9d971152012-12-19 00:43:11878</div>
879<div class="sect2">
880<h3 id="_commit_msg">commit-msg</h3>
Junio C Hamanob9d9d902018-05-23 07:07:42881<div class="paragraph"><p>This hook is invoked by <a href="git-commit.html">git-commit(1)</a> and <a href="git-merge.html">git-merge(1)</a>, and can be
Junio C Hamanoef75f372017-09-29 04:22:33882bypassed with the <code>--no-verify</code> option. It takes a single parameter,
883the name of the file that holds the proposed commit log message.
884Exiting with a non-zero status causes the command to abort.</p></div>
Junio C Hamano198b1f12016-05-17 22:27:24885<div class="paragraph"><p>The hook is allowed to edit the message file in place, and can be used
886to normalize the message into some project standard format. It
887can also be used to refuse the commit after inspecting the message
888file.</p></div>
Junio C Hamano81435632011-01-12 09:08:48889<div class="paragraph"><p>The default <em>commit-msg</em> hook, when enabled, detects duplicate
Junio C Hamanodf3d3cd2020-11-02 22:05:05890<code>Signed-off-by</code> trailers, and aborts the commit if one is found.</p></div>
Junio C Hamano9d971152012-12-19 00:43:11891</div>
892<div class="sect2">
893<h3 id="_post_commit">post-commit</h3>
Junio C Hamanob9d9d902018-05-23 07:07:42894<div class="paragraph"><p>This hook is invoked by <a href="git-commit.html">git-commit(1)</a>. It takes no parameters, and is
Junio C Hamano198b1f12016-05-17 22:27:24895invoked after a commit is made.</p></div>
Junio C Hamano81435632011-01-12 09:08:48896<div class="paragraph"><p>This hook is meant primarily for notification, and cannot affect
Junio C Hamanob9d9d902018-05-23 07:07:42897the outcome of <code>git commit</code>.</p></div>
Junio C Hamano9d971152012-12-19 00:43:11898</div>
899<div class="sect2">
900<h3 id="_pre_rebase">pre-rebase</h3>
Junio C Hamanob9d9d902018-05-23 07:07:42901<div class="paragraph"><p>This hook is called by <a href="git-rebase.html">git-rebase(1)</a> and can be used to prevent a
Junio C Hamano947ab822013-03-19 23:07:29902branch from getting rebased. The hook may be called with one or
903two parameters. The first parameter is the upstream from which
904the series was forked. The second parameter is the branch being
905rebased, and is not set when rebasing the current branch.</p></div>
Junio C Hamano9d971152012-12-19 00:43:11906</div>
907<div class="sect2">
908<h3 id="_post_checkout">post-checkout</h3>
Junio C Hamanoc9f11c22019-07-10 02:54:04909<div class="paragraph"><p>This hook is invoked when a <a href="git-checkout.html">git-checkout(1)</a> or
910<a href="git-switch.html">git-switch(1)</a> is run after having updated the
Junio C Hamano2fbcd212008-05-14 22:26:07911worktree. The hook is given three parameters: the ref of the previous HEAD,
912the ref of the new HEAD (which may or may not have changed), and a flag
913indicating whether the checkout was a branch checkout (changing branches,
914flag=1) or a file checkout (retrieving a file from the index, flag=0).
Junio C Hamano558abd22020-09-03 20:22:34915This hook cannot affect the outcome of <code>git switch</code> or <code>git checkout</code>,
916other than that the hook&#8217;s exit status becomes the exit status of
917these two commands.</p></div>
Junio C Hamanob9d9d902018-05-23 07:07:42918<div class="paragraph"><p>It is also run after <a href="git-clone.html">git-clone(1)</a>, unless the <code>--no-checkout</code> (<code>-n</code>) option is
Junio C Hamano36a56722009-03-28 08:55:34919used. The first parameter given to the hook is the null-ref, the second the
Junio C Hamanob9d9d902018-05-23 07:07:42920ref of the new HEAD and the flag is always 1. Likewise for <code>git worktree add</code>
921unless <code>--no-checkout</code> is used.</p></div>
Junio C Hamano81435632011-01-12 09:08:48922<div class="paragraph"><p>This hook can be used to perform repository validity checks, auto-display
Junio C Hamano2fbcd212008-05-14 22:26:07923differences from the previous HEAD if different, or set working dir metadata
Junio C Hamanoba4b9282008-07-06 05:20:31924properties.</p></div>
Junio C Hamano9d971152012-12-19 00:43:11925</div>
926<div class="sect2">
927<h3 id="_post_merge">post-merge</h3>
Junio C Hamanob9d9d902018-05-23 07:07:42928<div class="paragraph"><p>This hook is invoked by <a href="git-merge.html">git-merge(1)</a>, which happens when a <code>git pull</code>
Junio C Hamano2fbcd212008-05-14 22:26:07929is done on a local repository. The hook takes a single parameter, a status
930flag specifying whether or not the merge being done was a squash merge.
Junio C Hamanob9d9d902018-05-23 07:07:42931This hook cannot affect the outcome of <code>git merge</code> and is not executed,
Junio C Hamanoba4b9282008-07-06 05:20:31932if the merge failed due to conflicts.</p></div>
Junio C Hamano81435632011-01-12 09:08:48933<div class="paragraph"><p>This hook can be used in conjunction with a corresponding pre-commit hook to
Junio C Hamano2fbcd212008-05-14 22:26:07934save and restore any form of metadata associated with the working tree
Junio C Hamanofb5ffde2014-11-04 22:38:56935(e.g.: permissions/ownership, ACLS, etc). See contrib/hooks/setgitperms.perl
Junio C Hamanoba4b9282008-07-06 05:20:31936for an example of how to do this.</p></div>
Junio C Hamano9d971152012-12-19 00:43:11937</div>
938<div class="sect2">
Junio C Hamano36d52292013-01-25 21:32:36939<h3 id="_pre_push">pre-push</h3>
Junio C Hamanob9d9d902018-05-23 07:07:42940<div class="paragraph"><p>This hook is called by <a href="git-push.html">git-push(1)</a> and can be used to prevent
941a push from taking place. The hook is called with two parameters
942which provide the name and location of the destination remote, if a
943named remote is not being used both values will be the same.</p></div>
Junio C Hamano36d52292013-01-25 21:32:36944<div class="paragraph"><p>Information about what is to be pushed is provided on the hook&#8217;s standard
945input with lines of the form:</p></div>
946<div class="literalblock">
947<div class="content">
Junio C Hamano6546a502024-02-08 23:48:36948<pre><code>&lt;local-ref&gt; SP &lt;local-object-name&gt; SP &lt;remote-ref&gt; SP &lt;remote-object-name&gt; LF</code></pre>
Junio C Hamano36d52292013-01-25 21:32:36949</div></div>
Junio C Hamanoc14e6ad2014-10-31 20:25:53950<div class="paragraph"><p>For instance, if the command <code>git push origin master:foreign</code> were run the
Junio C Hamano36d52292013-01-25 21:32:36951hook would receive a line like the following:</p></div>
952<div class="literalblock">
953<div class="content">
Junio C Hamanoc14e6ad2014-10-31 20:25:53954<pre><code>refs/heads/master 67890 refs/heads/foreign 12345</code></pre>
Junio C Hamano36d52292013-01-25 21:32:36955</div></div>
Junio C Hamano458281a2021-03-22 21:20:26956<div class="paragraph"><p>although the full object name would be supplied. If the foreign ref does not
Junio C Hamano6546a502024-02-08 23:48:36957yet exist the <code>&lt;remote-object-name&gt;</code> will be the all-zeroes object name. If a
958ref is to be deleted, the <code>&lt;local-ref&gt;</code> will be supplied as <code>(delete)</code> and the
959<code>&lt;local-object-name&gt;</code> will be the all-zeroes object name. If the local commit
Junio C Hamano458281a2021-03-22 21:20:26960was specified by something other than a name which could be expanded (such as
961<code>HEAD~</code>, or an object name) it will be supplied as it was originally given.</p></div>
Junio C Hamanob9d9d902018-05-23 07:07:42962<div class="paragraph"><p>If this hook exits with a non-zero status, <code>git push</code> will abort without
Junio C Hamano36d52292013-01-25 21:32:36963pushing anything. Information about why the push is rejected may be sent
964to the user by writing to standard error.</p></div>
965</div>
966<div class="sect2">
Junio C Hamano9d971152012-12-19 00:43:11967<h3 id="pre-receive">pre-receive</h3>
Junio C Hamanob9d9d902018-05-23 07:07:42968<div class="paragraph"><p>This hook is invoked by <a href="git-receive-pack.html">git-receive-pack(1)</a> when it reacts to
969<code>git push</code> and updates reference(s) in its repository.
Junio C Hamano2fbcd212008-05-14 22:26:07970Just before starting to update refs on the remote repository, the
971pre-receive hook is invoked. Its exit status determines the success
Junio C Hamanoba4b9282008-07-06 05:20:31972or failure of the update.</p></div>
Junio C Hamano81435632011-01-12 09:08:48973<div class="paragraph"><p>This hook executes once for the receive operation. It takes no
Junio C Hamano2fbcd212008-05-14 22:26:07974arguments, but for each ref to be updated it receives on standard
Junio C Hamanoba4b9282008-07-06 05:20:31975input a line of the format:</p></div>
Junio C Hamano2fbcd212008-05-14 22:26:07976<div class="literalblock">
977<div class="content">
Junio C Hamano15cf9672024-04-10 19:47:56978<pre><code>&lt;old-oid&gt; SP &lt;new-oid&gt; SP &lt;ref-name&gt; LF</code></pre>
Junio C Hamano2fbcd212008-05-14 22:26:07979</div></div>
Junio C Hamano15cf9672024-04-10 19:47:56980<div class="paragraph"><p>where <code>&lt;old-oid&gt;</code> is the old object name stored in the ref,
981<code>&lt;new-oid&gt;</code> is the new object name to be stored in the ref and
Junio C Hamanoc14e6ad2014-10-31 20:25:53982<code>&lt;ref-name&gt;</code> is the full name of the ref.
Junio C Hamano15cf9672024-04-10 19:47:56983When creating a new ref, <code>&lt;old-oid&gt;</code> is the all-zeroes object name.</p></div>
Junio C Hamano81435632011-01-12 09:08:48984<div class="paragraph"><p>If the hook exits with non-zero status, none of the refs will be
Junio C Hamano2fbcd212008-05-14 22:26:07985updated. If the hook exits with zero, updating of individual refs can
Junio C Hamanoba4b9282008-07-06 05:20:31986still be prevented by the <a href="#update"><em>update</em></a> hook.</p></div>
Junio C Hamano81435632011-01-12 09:08:48987<div class="paragraph"><p>Both standard output and standard error output are forwarded to
Junio C Hamanob9d9d902018-05-23 07:07:42988<code>git send-pack</code> on the other end, so you can simply <code>echo</code> messages
Junio C Hamanoba4b9282008-07-06 05:20:31989for the user.</p></div>
Junio C Hamanoe48a1132016-08-03 22:40:21990<div class="paragraph"><p>The number of push options given on the command line of
991<code>git push --push-option=...</code> can be read from the environment
992variable <code>GIT_PUSH_OPTION_COUNT</code>, and the options themselves are
993found in <code>GIT_PUSH_OPTION_0</code>, <code>GIT_PUSH_OPTION_1</code>,&#8230;
994If it is negotiated to not use the push options phase, the
995environment variables will not be set. If the client selects
996to use push options, but doesn&#8217;t transmit any, the count variable
997will be set to zero, <code>GIT_PUSH_OPTION_COUNT=0</code>.</p></div>
Junio C Hamanoe25cc812017-04-24 06:17:43998<div class="paragraph"><p>See the section on "Quarantine Environment" in
999<a href="git-receive-pack.html">git-receive-pack(1)</a> for some caveats.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111000</div>
1001<div class="sect2">
1002<h3 id="update">update</h3>
Junio C Hamanob9d9d902018-05-23 07:07:421003<div class="paragraph"><p>This hook is invoked by <a href="git-receive-pack.html">git-receive-pack(1)</a> when it reacts to
1004<code>git push</code> and updates reference(s) in its repository.
Junio C Hamano2fbcd212008-05-14 22:26:071005Just before updating the ref on the remote repository, the update hook
1006is invoked. Its exit status determines the success or failure of
Junio C Hamanoba4b9282008-07-06 05:20:311007the ref update.</p></div>
Junio C Hamano81435632011-01-12 09:08:481008<div class="paragraph"><p>The hook executes once for each ref to be updated, and takes
Junio C Hamanoba4b9282008-07-06 05:20:311009three parameters:</p></div>
Junio C Hamano81435632011-01-12 09:08:481010<div class="ulist"><ul>
Junio C Hamano2fbcd212008-05-14 22:26:071011<li>
1012<p>
1013the name of the ref being updated,
1014</p>
1015</li>
1016<li>
1017<p>
1018the old object name stored in the ref,
1019</p>
1020</li>
1021<li>
1022<p>
Junio C Hamano826f5c42014-02-07 20:33:301023and the new object name to be stored in the ref.
Junio C Hamano2fbcd212008-05-14 22:26:071024</p>
1025</li>
Junio C Hamanoba4b9282008-07-06 05:20:311026</ul></div>
Junio C Hamano81435632011-01-12 09:08:481027<div class="paragraph"><p>A zero exit from the update hook allows the ref to be updated.
Junio C Hamanob9d9d902018-05-23 07:07:421028Exiting with a non-zero status prevents <code>git receive-pack</code>
Junio C Hamanoba4b9282008-07-06 05:20:311029from updating that ref.</p></div>
Junio C Hamano81435632011-01-12 09:08:481030<div class="paragraph"><p>This hook can be used to prevent <em>forced</em> update on certain refs by
Junio C Hamano2fbcd212008-05-14 22:26:071031making sure that the object name is a commit object that is a
1032descendant of the commit object named by the old object name.
Junio C Hamano3f680f32009-11-16 02:10:541033That is, to enforce a "fast-forward only" policy.</p></div>
Junio C Hamano81435632011-01-12 09:08:481034<div class="paragraph"><p>It could also be used to log the old..new status. However, it
Junio C Hamano2fbcd212008-05-14 22:26:071035does not know the entire set of branches, so it would end up
1036firing one e-mail per ref when used naively, though. The
Junio C Hamanoba4b9282008-07-06 05:20:311037<a href="#post-receive"><em>post-receive</em></a> hook is more suited to that.</p></div>
Junio C Hamano198b1f12016-05-17 22:27:241038<div class="paragraph"><p>In an environment that restricts the users' access only to git
1039commands over the wire, this hook can be used to implement access
1040control without relying on filesystem ownership and group
1041membership. See <a href="git-shell.html">git-shell(1)</a> for how you might use the login
1042shell to restrict the user&#8217;s access to only git commands.</p></div>
Junio C Hamano81435632011-01-12 09:08:481043<div class="paragraph"><p>Both standard output and standard error output are forwarded to
Junio C Hamanob9d9d902018-05-23 07:07:421044<code>git send-pack</code> on the other end, so you can simply <code>echo</code> messages
Junio C Hamanoba4b9282008-07-06 05:20:311045for the user.</p></div>
Junio C Hamano81435632011-01-12 09:08:481046<div class="paragraph"><p>The default <em>update</em> hook, when enabled&#8212;and with
Junio C Hamanoc14e6ad2014-10-31 20:25:531047<code>hooks.allowunannotated</code> config option unset or set to false&#8212;prevents
Junio C Hamano33be8212023-10-23 21:45:541048unannotated tags from being pushed.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111049</div>
1050<div class="sect2">
Junio C Hamanoc562f6d2020-09-25 22:50:121051<h3 id="proc-receive">proc-receive</h3>
1052<div class="paragraph"><p>This hook is invoked by <a href="git-receive-pack.html">git-receive-pack(1)</a>. If the server has
1053set the multi-valued config variable <code>receive.procReceiveRefs</code>, and the
1054commands sent to <em>receive-pack</em> have matching reference names, these
1055commands will be executed by this hook, instead of by the internal
1056<code>execute_commands()</code> function. This hook is responsible for updating
1057the relevant references and reporting the results back to <em>receive-pack</em>.</p></div>
1058<div class="paragraph"><p>This hook executes once for the receive operation. It takes no
1059arguments, but uses a pkt-line format protocol to communicate with
1060<em>receive-pack</em> to read commands, push-options and send results. In the
1061following example for the protocol, the letter <em>S</em> stands for
1062<em>receive-pack</em> and the letter <em>H</em> stands for this hook.</p></div>
1063<div class="literalblock">
1064<div class="content">
1065<pre><code># Version and features negotiation.
1066S: PKT-LINE(version=1\0push-options atomic...)
1067S: flush-pkt
1068H: PKT-LINE(version=1\0push-options...)
1069H: flush-pkt</code></pre>
1070</div></div>
1071<div class="literalblock">
1072<div class="content">
1073<pre><code># Send commands from server to the hook.
1074S: PKT-LINE(&lt;old-oid&gt; &lt;new-oid&gt; &lt;ref&gt;)
1075S: ... ...
1076S: flush-pkt
1077# Send push-options only if the 'push-options' feature is enabled.
1078S: PKT-LINE(push-option)
1079S: ... ...
1080S: flush-pkt</code></pre>
1081</div></div>
1082<div class="literalblock">
1083<div class="content">
Junio C Hamano33be8212023-10-23 21:45:541084<pre><code># Receive results from the hook.
Junio C Hamanoc562f6d2020-09-25 22:50:121085# OK, run this command successfully.
1086H: PKT-LINE(ok &lt;ref&gt;)
1087# NO, I reject it.
1088H: PKT-LINE(ng &lt;ref&gt; &lt;reason&gt;)
Junio C Hamano33be8212023-10-23 21:45:541089# Fall through, let 'receive-pack' execute it.
Junio C Hamanoc562f6d2020-09-25 22:50:121090H: PKT-LINE(ok &lt;ref&gt;)
1091H: PKT-LINE(option fall-through)
1092# OK, but has an alternate reference. The alternate reference name
1093# and other status can be given in option directives.
1094H: PKT-LINE(ok &lt;ref&gt;)
1095H: PKT-LINE(option refname &lt;refname&gt;)
1096H: PKT-LINE(option old-oid &lt;old-oid&gt;)
1097H: PKT-LINE(option new-oid &lt;new-oid&gt;)
1098H: PKT-LINE(option forced-update)
1099H: ... ...
1100H: flush-pkt</code></pre>
1101</div></div>
1102<div class="paragraph"><p>Each command for the <em>proc-receive</em> hook may point to a pseudo-reference
1103and always has a zero-old as its old-oid, while the <em>proc-receive</em> hook
1104may update an alternate reference and the alternate reference may exist
1105already with a non-zero old-oid. For this case, this hook will use
1106"option" directives to report extended attributes for the reference given
1107by the leading "ok" directive.</p></div>
1108<div class="paragraph"><p>The report of the commands of this hook should have the same order as
1109the input. The exit status of the <em>proc-receive</em> hook only determines
1110the success or failure of the group of commands sent to it, unless
1111atomic push is in use.</p></div>
1112</div>
1113<div class="sect2">
Junio C Hamano9d971152012-12-19 00:43:111114<h3 id="post-receive">post-receive</h3>
Junio C Hamanob9d9d902018-05-23 07:07:421115<div class="paragraph"><p>This hook is invoked by <a href="git-receive-pack.html">git-receive-pack(1)</a> when it reacts to
1116<code>git push</code> and updates reference(s) in its repository.
Junio C Hamano2fbcd212008-05-14 22:26:071117It executes on the remote repository once after all the refs have
Junio C Hamanoba4b9282008-07-06 05:20:311118been updated.</p></div>
Junio C Hamano81435632011-01-12 09:08:481119<div class="paragraph"><p>This hook executes once for the receive operation. It takes no
Junio C Hamano2fbcd212008-05-14 22:26:071120arguments, but gets the same information as the
1121<a href="#pre-receive"><em>pre-receive</em></a>
Junio C Hamanoba4b9282008-07-06 05:20:311122hook does on its standard input.</p></div>
Junio C Hamanob9d9d902018-05-23 07:07:421123<div class="paragraph"><p>This hook does not affect the outcome of <code>git receive-pack</code>, as it
Junio C Hamanoba4b9282008-07-06 05:20:311124is called after the real work is done.</p></div>
Junio C Hamano81435632011-01-12 09:08:481125<div class="paragraph"><p>This supersedes the <a href="#post-update"><em>post-update</em></a> hook in that it gets
Junio C Hamano2fbcd212008-05-14 22:26:071126both old and new values of all the refs in addition to their
Junio C Hamanoba4b9282008-07-06 05:20:311127names.</p></div>
Junio C Hamano81435632011-01-12 09:08:481128<div class="paragraph"><p>Both standard output and standard error output are forwarded to
Junio C Hamanob9d9d902018-05-23 07:07:421129<code>git send-pack</code> on the other end, so you can simply <code>echo</code> messages
Junio C Hamanoba4b9282008-07-06 05:20:311130for the user.</p></div>
Junio C Hamano81435632011-01-12 09:08:481131<div class="paragraph"><p>The default <em>post-receive</em> hook is empty, but there is
Junio C Hamanoc14e6ad2014-10-31 20:25:531132a sample script <code>post-receive-email</code> provided in the <code>contrib/hooks</code>
Junio C Hamano076ffcc2013-02-06 05:13:211133directory in Git distribution, which implements sending commit
Junio C Hamanoba4b9282008-07-06 05:20:311134emails.</p></div>
Junio C Hamanoe48a1132016-08-03 22:40:211135<div class="paragraph"><p>The number of push options given on the command line of
1136<code>git push --push-option=...</code> can be read from the environment
1137variable <code>GIT_PUSH_OPTION_COUNT</code>, and the options themselves are
1138found in <code>GIT_PUSH_OPTION_0</code>, <code>GIT_PUSH_OPTION_1</code>,&#8230;
1139If it is negotiated to not use the push options phase, the
1140environment variables will not be set. If the client selects
1141to use push options, but doesn&#8217;t transmit any, the count variable
1142will be set to zero, <code>GIT_PUSH_OPTION_COUNT=0</code>.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111143</div>
1144<div class="sect2">
1145<h3 id="post-update">post-update</h3>
Junio C Hamanob9d9d902018-05-23 07:07:421146<div class="paragraph"><p>This hook is invoked by <a href="git-receive-pack.html">git-receive-pack(1)</a> when it reacts to
1147<code>git push</code> and updates reference(s) in its repository.
Junio C Hamano2fbcd212008-05-14 22:26:071148It executes on the remote repository once after all the refs have
Junio C Hamanoba4b9282008-07-06 05:20:311149been updated.</p></div>
Junio C Hamano81435632011-01-12 09:08:481150<div class="paragraph"><p>It takes a variable number of parameters, each of which is the
Junio C Hamanoba4b9282008-07-06 05:20:311151name of ref that was actually updated.</p></div>
Junio C Hamano81435632011-01-12 09:08:481152<div class="paragraph"><p>This hook is meant primarily for notification, and cannot affect
Junio C Hamanob9d9d902018-05-23 07:07:421153the outcome of <code>git receive-pack</code>.</p></div>
Junio C Hamano81435632011-01-12 09:08:481154<div class="paragraph"><p>The <em>post-update</em> hook can tell what are the heads that were pushed,
Junio C Hamano2fbcd212008-05-14 22:26:071155but it does not know what their original and updated values are,
1156so it is a poor place to do log old..new. The
1157<a href="#post-receive"><em>post-receive</em></a> hook does get both original and
1158updated values of the refs. You might consider it instead if you need
Junio C Hamanoba4b9282008-07-06 05:20:311159them.</p></div>
Junio C Hamano81435632011-01-12 09:08:481160<div class="paragraph"><p>When enabled, the default <em>post-update</em> hook runs
Junio C Hamanob9d9d902018-05-23 07:07:421161<code>git update-server-info</code> to keep the information used by dumb
Junio C Hamano88bf5712017-09-10 08:39:231162transports (e.g., HTTP) up to date. If you are publishing
Junio C Hamano076ffcc2013-02-06 05:13:211163a Git repository that is accessible via HTTP, you should
Junio C Hamanoba4b9282008-07-06 05:20:311164probably enable this hook.</p></div>
Junio C Hamano81435632011-01-12 09:08:481165<div class="paragraph"><p>Both standard output and standard error output are forwarded to
Junio C Hamanob9d9d902018-05-23 07:07:421166<code>git send-pack</code> on the other end, so you can simply <code>echo</code> messages
Junio C Hamanoba4b9282008-07-06 05:20:311167for the user.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111168</div>
1169<div class="sect2">
Junio C Hamanoc93f3212020-07-24 23:16:191170<h3 id="_reference_transaction">reference-transaction</h3>
Junio C Hamanoa8911782020-07-07 05:35:571171<div class="paragraph"><p>This hook is invoked by any Git command that performs reference
1172updates. It executes whenever a reference transaction is prepared,
Junio C Hamano458281a2021-03-22 21:20:261173committed or aborted and may thus get called multiple times. The hook
Junio C Hamanod414f4c2024-05-23 19:16:321174also supports symbolic reference updates.</p></div>
Junio C Hamanoa8911782020-07-07 05:35:571175<div class="paragraph"><p>The hook takes exactly one argument, which is the current state the
1176given reference transaction is in:</p></div>
1177<div class="ulist"><ul>
1178<li>
1179<p>
1180"prepared": All reference updates have been queued to the
1181 transaction and references were locked on disk.
1182</p>
1183</li>
1184<li>
1185<p>
1186"committed": The reference transaction was committed and all
1187 references now have their respective new value.
1188</p>
1189</li>
1190<li>
1191<p>
1192"aborted": The reference transaction was aborted, no changes
1193 were performed and the locks have been released.
1194</p>
1195</li>
1196</ul></div>
1197<div class="paragraph"><p>For each reference update that was added to the transaction, the hook
1198receives on standard input a line of the format:</p></div>
1199<div class="literalblock">
1200<div class="content">
Junio C Hamanod414f4c2024-05-23 19:16:321201<pre><code>&lt;old-value&gt; SP &lt;new-value&gt; SP &lt;ref-name&gt; LF</code></pre>
Junio C Hamanoa8911782020-07-07 05:35:571202</div></div>
Junio C Hamanod414f4c2024-05-23 19:16:321203<div class="paragraph"><p>where <code>&lt;old-value&gt;</code> is the old object name passed into the reference
1204transaction, <code>&lt;new-value&gt;</code> is the new object name to be stored in the
Junio C Hamano458281a2021-03-22 21:20:261205ref and <code>&lt;ref-name&gt;</code> is the full name of the ref. When force updating
1206the reference regardless of its current value or when the reference is
Junio C Hamanod414f4c2024-05-23 19:16:321207to be created anew, <code>&lt;old-value&gt;</code> is the all-zeroes object name. To
Junio C Hamano458281a2021-03-22 21:20:261208distinguish these cases, you can inspect the current value of
1209<code>&lt;ref-name&gt;</code> via <code>git rev-parse</code>.</p></div>
Junio C Hamanod414f4c2024-05-23 19:16:321210<div class="paragraph"><p>For symbolic reference updates the <code>&lt;old_value&gt;</code> and <code>&lt;new-value&gt;</code>
1211fields could denote references instead of objects. A reference will be
1212denoted with a <em>ref:</em> prefix, like <code>ref:&lt;ref-target&gt;</code>.</p></div>
Junio C Hamanoa8911782020-07-07 05:35:571213<div class="paragraph"><p>The exit status of the hook is ignored for any state except for the
1214"prepared" state. In the "prepared" state, a non-zero exit status will
1215cause the transaction to be aborted. The hook will not be called with
1216"aborted" state in that case.</p></div>
1217</div>
1218<div class="sect2">
Junio C Hamano6bb32e62015-02-17 22:11:261219<h3 id="_push_to_checkout">push-to-checkout</h3>
Junio C Hamanob9d9d902018-05-23 07:07:421220<div class="paragraph"><p>This hook is invoked by <a href="git-receive-pack.html">git-receive-pack(1)</a> when it reacts to
1221<code>git push</code> and updates reference(s) in its repository, and when
Junio C Hamano6bb32e62015-02-17 22:11:261222the push tries to update the branch that is currently checked out
1223and the <code>receive.denyCurrentBranch</code> configuration variable is set to
1224<code>updateInstead</code>. Such a push by default is refused if the working
1225tree and the index of the remote repository has any difference from
1226the currently checked out commit; when both the working tree and the
1227index match the current commit, they are updated to match the newly
1228pushed tip of the branch. This hook is to be used to override the
1229default behaviour.</p></div>
1230<div class="paragraph"><p>The hook receives the commit with which the tip of the current
1231branch is going to be updated. It can exit with a non-zero status
1232to refuse the push (when it does so, it must not modify the index or
1233the working tree). Or it can make any necessary changes to the
1234working tree and to the index to bring them to the desired state
1235when the tip of the current branch is updated to the new commit, and
1236exit with a zero status.</p></div>
1237<div class="paragraph"><p>For example, the hook can simply run <code>git read-tree -u -m HEAD "$1"</code>
Junio C Hamanob9d9d902018-05-23 07:07:421238in order to emulate <code>git fetch</code> that is run in the reverse direction
1239with <code>git push</code>, as the two-tree form of <code>git read-tree -u -m</code> is
Junio C Hamanoc9f11c22019-07-10 02:54:041240essentially the same as <code>git switch</code> or <code>git checkout</code>
1241that switches branches while
Junio C Hamano6bb32e62015-02-17 22:11:261242keeping the local changes in the working tree that do not interfere
1243with the difference between the branches.</p></div>
1244</div>
1245<div class="sect2">
Junio C Hamano9d971152012-12-19 00:43:111246<h3 id="_pre_auto_gc">pre-auto-gc</h3>
Junio C Hamanob9d9d902018-05-23 07:07:421247<div class="paragraph"><p>This hook is invoked by <code>git gc --auto</code> (see <a href="git-gc.html">git-gc(1)</a>). It
1248takes no parameter, and exiting with non-zero status from this script
1249causes the <code>git gc --auto</code> to abort.</p></div>
Junio C Hamano9d971152012-12-19 00:43:111250</div>
1251<div class="sect2">
1252<h3 id="_post_rewrite">post-rewrite</h3>
Junio C Hamanob9d9d902018-05-23 07:07:421253<div class="paragraph"><p>This hook is invoked by commands that rewrite commits
1254(<a href="git-commit.html">git-commit(1)</a> when called with <code>--amend</code> and
Junio C Hamanoa8858312019-09-30 05:07:451255<a href="git-rebase.html">git-rebase(1)</a>; however, full-history (re)writing tools like
1256<a href="git-fast-import.html">git-fast-import(1)</a> or
1257<a href="https://github.com/newren/git-filter-repo">git-filter-repo</a> typically
1258do not call it!). Its first argument denotes the command it was
1259invoked by: currently one of <code>amend</code> or <code>rebase</code>. Further
1260command-dependent arguments may be passed in the future.</p></div>
Junio C Hamano81435632011-01-12 09:08:481261<div class="paragraph"><p>The hook receives a list of the rewritten commits on stdin, in the
Junio C Hamano31667362010-03-25 00:38:531262format</p></div>
1263<div class="literalblock">
1264<div class="content">
Junio C Hamano458281a2021-03-22 21:20:261265<pre><code>&lt;old-object-name&gt; SP &lt;new-object-name&gt; [ SP &lt;extra-info&gt; ] LF</code></pre>
Junio C Hamano31667362010-03-25 00:38:531266</div></div>
Junio C Hamano81435632011-01-12 09:08:481267<div class="paragraph"><p>The <em>extra-info</em> is again command-dependent. If it is empty, the
Junio C Hamano31667362010-03-25 00:38:531268preceding SP is also omitted. Currently, no commands pass any
1269<em>extra-info</em>.</p></div>
Junio C Hamano81435632011-01-12 09:08:481270<div class="paragraph"><p>The hook always runs after the automatic note copying (see
Junio C Hamano96fdfa12016-03-21 20:52:391271"notes.rewrite.&lt;command&gt;" in <a href="git-config.html">git-config(1)</a>) has happened, and
Junio C Hamano31667362010-03-25 00:38:531272thus has access to these notes.</p></div>
Junio C Hamano81435632011-01-12 09:08:481273<div class="paragraph"><p>The following command-specific comments apply:</p></div>
1274<div class="dlist"><dl>
1275<dt class="hdlist1">
Junio C Hamano31667362010-03-25 00:38:531276rebase
1277</dt>
1278<dd>
1279<p>
1280 For the <em>squash</em> and <em>fixup</em> operation, all commits that were
1281 squashed are listed as being rewritten to the squashed commit.
1282 This means that there will be several lines sharing the same
Junio C Hamano458281a2021-03-22 21:20:261283 <em>new-object-name</em>.
Junio C Hamano31667362010-03-25 00:38:531284</p>
Junio C Hamano81435632011-01-12 09:08:481285<div class="paragraph"><p>The commits are guaranteed to be listed in the order that they were
Junio C Hamano31667362010-03-25 00:38:531286processed by rebase.</p></div>
1287</dd>
1288</dl></div>
Junio C Hamano2fbcd212008-05-14 22:26:071289</div>
Junio C Hamanod88ba732017-05-30 04:14:201290<div class="sect2">
1291<h3 id="_sendemail_validate">sendemail-validate</h3>
Junio C Hamano7ab2d202023-05-10 18:59:241292<div class="paragraph"><p>This hook is invoked by <a href="git-send-email.html">git-send-email(1)</a>.</p></div>
1293<div class="paragraph"><p>It takes these command line arguments. They are,
12941. the name of the file which holds the contents of the email to be sent.
12952. The name of the file which holds the SMTP headers of the email.</p></div>
1296<div class="paragraph"><p>The SMTP headers are passed in the exact same way as they are passed to the
1297user&#8217;s Mail Transport Agent (MTA). In effect, the email given to the user&#8217;s
1298MTA, is the contents of $2 followed by the contents of $1.</p></div>
1299<div class="paragraph"><p>An example of a few common headers is shown below. Take notice of the
1300capitalization and multi-line tab structure.</p></div>
1301<div class="literalblock">
1302<div class="content">
1303<pre><code>From: Example &lt;from@example.com&gt;
1304To: to@example.com
1305Cc: cc@example.com,
1306 A &lt;author@example.com&gt;,
1307 One &lt;one@example.com&gt;,
1308 two@example.com
1309Subject: PATCH-STRING</code></pre>
1310</div></div>
1311<div class="paragraph"><p>Exiting with a non-zero status causes <code>git send-email</code> to abort
1312before sending any e-mails.</p></div>
Junio C Hamano9f24e832023-04-25 21:41:321313<div class="paragraph"><p>The following environment variables are set when executing the hook.</p></div>
1314<div class="dlist"><dl>
1315<dt class="hdlist1">
1316<code>GIT_SENDEMAIL_FILE_COUNTER</code>
1317</dt>
1318<dd>
1319<p>
1320 A 1-based counter incremented by one for every file holding an e-mail
1321 to be sent (excluding any FIFOs). This counter does not follow the
1322 patch series counter scheme. It will always start at 1 and will end at
1323 GIT_SENDEMAIL_FILE_TOTAL.
1324</p>
1325</dd>
1326<dt class="hdlist1">
1327<code>GIT_SENDEMAIL_FILE_TOTAL</code>
1328</dt>
1329<dd>
1330<p>
1331 The total number of files that will be sent (excluding any FIFOs). This
1332 counter does not follow the patch series counter scheme. It will always
1333 be equal to the number of files being sent, whether there is a cover
1334 letter or not.
1335</p>
1336</dd>
1337</dl></div>
1338<div class="paragraph"><p>These variables may for instance be used to validate patch series.</p></div>
1339<div class="paragraph"><p>The sample <code>sendemail-validate</code> hook that comes with Git checks that all sent
1340patches (excluding the cover letter) can be applied on top of the upstream
1341repository default branch without conflicts. Some placeholders are left for
1342additional validation steps to be performed after all patches of a given series
1343have been applied.</p></div>
Junio C Hamanod88ba732017-05-30 04:14:201344</div>
Junio C Hamanod7105602017-11-21 05:32:501345<div class="sect2">
1346<h3 id="_fsmonitor_watchman">fsmonitor-watchman</h3>
Junio C Hamanob9d9d902018-05-23 07:07:421347<div class="paragraph"><p>This hook is invoked when the configuration option <code>core.fsmonitor</code> is
Junio C Hamanofc6646b2020-02-14 23:35:161348set to <code>.git/hooks/fsmonitor-watchman</code> or <code>.git/hooks/fsmonitor-watchmanv2</code>
1349depending on the version of the hook to use.</p></div>
1350<div class="paragraph"><p>Version 1 takes two arguments, a version (1) and the time in elapsed
1351nanoseconds since midnight, January 1, 1970.</p></div>
1352<div class="paragraph"><p>Version 2 takes two arguments, a version (2) and a token that is used
1353for identifying changes since the token. For watchman this would be
1354a clock id. This version must output to stdout the new token followed
1355by a NUL before the list of files.</p></div>
Junio C Hamanod7105602017-11-21 05:32:501356<div class="paragraph"><p>The hook should output to stdout the list of all files in the working
1357directory that may have changed since the requested time. The logic
1358should be inclusive so that it does not miss any potential changes.
1359The paths should be relative to the root of the working directory
1360and be separated by a single NUL.</p></div>
1361<div class="paragraph"><p>It is OK to include files which have not actually changed. All changes
1362including newly-created and deleted files should be included. When
1363files are renamed, both the old and the new name should be included.</p></div>
1364<div class="paragraph"><p>Git will limit what files it checks for changes as well as which
1365directories are checked for untracked files based on the path names
1366given.</p></div>
1367<div class="paragraph"><p>An optimized way to tell git "all files have changed" is to return
Junio C Hamanob9d9d902018-05-23 07:07:421368the filename <code>/</code>.</p></div>
Junio C Hamanod7105602017-11-21 05:32:501369<div class="paragraph"><p>The exit status determines whether git will use the data from the
1370hook to limit its search. On error, it will fall back to verifying
1371all files and folders.</p></div>
1372</div>
Junio C Hamanobfd91f42018-08-17 22:21:161373<div class="sect2">
Junio C Hamano67bf2242020-04-22 21:41:441374<h3 id="_p4_changelist">p4-changelist</h3>
1375<div class="paragraph"><p>This hook is invoked by <code>git-p4 submit</code>.</p></div>
1376<div class="paragraph"><p>The <code>p4-changelist</code> hook is executed after the changelist
1377message has been edited by the user. It can be bypassed with the
1378<code>--no-verify</code> option. It takes a single parameter, the name
1379of the file that holds the proposed changelist text. Exiting
1380with a non-zero status causes the command to abort.</p></div>
1381<div class="paragraph"><p>The hook is allowed to edit the changelist file and can be used
1382to normalize the text into some project standard format. It can
1383also be used to refuse the Submit after inspect the message file.</p></div>
1384<div class="paragraph"><p>Run <code>git-p4 submit --help</code> for details.</p></div>
1385</div>
1386<div class="sect2">
1387<h3 id="_p4_prepare_changelist">p4-prepare-changelist</h3>
1388<div class="paragraph"><p>This hook is invoked by <code>git-p4 submit</code>.</p></div>
1389<div class="paragraph"><p>The <code>p4-prepare-changelist</code> hook is executed right after preparing
1390the default changelist message and before the editor is started.
1391It takes one parameter, the name of the file that contains the
1392changelist text. Exiting with a non-zero status from the script
1393will abort the process.</p></div>
1394<div class="paragraph"><p>The purpose of the hook is to edit the message file in place,
Junio C Hamanod5cfc8f2021-01-16 00:14:511395and it is not suppressed by the <code>--no-verify</code> option. This hook
Junio C Hamano67bf2242020-04-22 21:41:441396is called even if <code>--prepare-p4-only</code> is set.</p></div>
1397<div class="paragraph"><p>Run <code>git-p4 submit --help</code> for details.</p></div>
1398</div>
1399<div class="sect2">
1400<h3 id="_p4_post_changelist">p4-post-changelist</h3>
1401<div class="paragraph"><p>This hook is invoked by <code>git-p4 submit</code>.</p></div>
1402<div class="paragraph"><p>The <code>p4-post-changelist</code> hook is invoked after the submit has
Junio C Hamanoee43d182020-11-11 22:10:411403successfully occurred in P4. It takes no parameters and is meant
Junio C Hamano67bf2242020-04-22 21:41:441404primarily for notification and cannot affect the outcome of the
1405git p4 submit action.</p></div>
1406<div class="paragraph"><p>Run <code>git-p4 submit --help</code> for details.</p></div>
1407</div>
1408<div class="sect2">
Junio C Hamanobfd91f42018-08-17 22:21:161409<h3 id="_p4_pre_submit">p4-pre-submit</h3>
1410<div class="paragraph"><p>This hook is invoked by <code>git-p4 submit</code>. It takes no parameters and nothing
1411from standard input. Exiting with non-zero status from this script prevent
Junio C Hamano67bf2242020-04-22 21:41:441412<code>git-p4 submit</code> from launching. It can be bypassed with the <code>--no-verify</code>
1413command line option. Run <code>git-p4 submit --help</code> for details.</p></div>
Junio C Hamanobfd91f42018-08-17 22:21:161414</div>
Junio C Hamano2ba14712019-04-25 10:12:271415<div class="sect2">
1416<h3 id="_post_index_change">post-index-change</h3>
1417<div class="paragraph"><p>This hook is invoked when the index is written in read-cache.c
1418do_write_locked_index.</p></div>
1419<div class="paragraph"><p>The first parameter passed to the hook is the indicator for the
1420working directory being updated. "1" meaning working directory
1421was updated or "0" when the working directory was not updated.</p></div>
1422<div class="paragraph"><p>The second parameter passed to the hook is the indicator for whether
1423or not the index was updated and the skip-worktree bit could have
1424changed. "1" meaning skip-worktree bits could have been updated
1425and "0" meaning they were not.</p></div>
1426<div class="paragraph"><p>Only one parameter should be set to "1" when the hook runs. The hook
1427running passing "1", "1" should not be possible.</p></div>
1428</div>
Junio C Hamano9d971152012-12-19 00:43:111429</div>
1430</div>
1431<div class="sect1">
Junio C Hamanof1fc6ca2022-02-17 01:32:331432<h2 id="_see_also">SEE ALSO</h2>
1433<div class="sectionbody">
1434<div class="paragraph"><p><a href="git-hook.html">git-hook(1)</a></p></div>
1435</div>
1436</div>
1437<div class="sect1">
Junio C Hamanoba4b9282008-07-06 05:20:311438<h2 id="_git">GIT</h2>
Junio C Hamano2fbcd212008-05-14 22:26:071439<div class="sectionbody">
Junio C Hamanoa28a9202012-06-21 07:08:231440<div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano2fbcd212008-05-14 22:26:071441</div>
Junio C Hamano7bd050f2011-09-22 06:32:221442</div>
Junio C Hamano9d971152012-12-19 00:43:111443</div>
Junio C Hamano7bd050f2011-09-22 06:32:221444<div id="footnotes"><hr /></div>
Junio C Hamano2fbcd212008-05-14 22:26:071445<div id="footer">
1446<div id="footer-text">
Junio C Hamano2ef0ba32018-01-26 23:13:531447Last updated
Junio C Hamanod414f4c2024-05-23 19:16:321448 2024-05-23 12:14:58 PDT
Junio C Hamano2fbcd212008-05-14 22:26:071449</div>
1450</div>
1451</body>
1452</html>